home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / ilisp / ilisp-key.el.z / ilisp-key.el
Encoding:
Text File  |  1998-05-21  |  7.5 KB  |  192 lines

  1. ;;; -*- Mode: Emacs-Lisp -*-
  2.  
  3. ;;; ilisp-key.el --
  4.  
  5. ;;; This file is part of ILISP.
  6. ;;; Version: 5.8
  7. ;;;
  8. ;;; Copyright (C) 1990, 1991, 1992, 1993 Chris McConnell
  9. ;;;               1993, 1994 Ivan Vasquez
  10. ;;;               1994, 1995, 1996 Marco Antoniotti and Rick Busdiecker
  11. ;;;               1996 Marco Antoniotti and Rick Campbell
  12. ;;;
  13. ;;; Other authors' names for which this Copyright notice also holds
  14. ;;; may appear later in this file.
  15. ;;;
  16. ;;; Send mail to 'ilisp-request@naggum.no' to be included in the
  17. ;;; ILISP mailing list. 'ilisp@naggum.no' is the general ILISP
  18. ;;; mailing list were bugs and improvements are discussed.
  19. ;;;
  20. ;;; ILISP is freely redistributable under the terms found in the file
  21. ;;; COPYING.
  22.  
  23.  
  24.  
  25. ;;;
  26. ;;; ILISP keybinding definitions.
  27. ;;;
  28.  
  29.  
  30. ;;; ilisp-where-is --
  31. ;;; New version provided by yusuf@SPD-13.ils.nwu.edu (Yusuf Pisan)
  32. ;;; Note: this used to be in 'ilisp-cpat'. Its definition did not make
  33. ;;;       much sense. Yusuf noted this and I decided to move it in
  34. ;;;       this file (where I think is more approriate).
  35. ;;;       11/24/94: Marco Antoniotti
  36.  
  37. (defun ilisp-where-is (command)
  38.   (let ((cmd (where-is-internal command nil t)))
  39.     (if cmd (key-description cmd))))
  40.  
  41.  
  42. ;;;
  43. ;;;%Bindings
  44. (defun ilisp-defkey (keymap key command)
  45.   "Define KEYMAP ilisp-prefix+KEY as command."
  46.   (let ((prefix-map (lookup-key keymap ilisp-prefix)))
  47.     (if (not (keymapp prefix-map))
  48.     (setq prefix-map
  49.           (define-key keymap ilisp-prefix (make-sparse-keymap))))
  50.     (define-key prefix-map key command)))
  51.  
  52. (defun defkey-ilisp (key command)
  53.   "Define KEY as COMMAND in ilisp-mode-map and lisp-mode-map"
  54.   (if (not ilisp-mode-map) (ilisp-bindings))
  55.   (define-key ilisp-mode-map key command)
  56.   (define-key lisp-mode-map key command))
  57.  
  58. ;;;
  59. (defun lisp-bindings (keymap &optional inferior-p)
  60.   "Set up the bindings for interacting with an inferior LISP in
  61. KEYMAP."
  62.   (if inferior-p
  63.       (progn (define-key keymap "\C-m" 'return-ilisp)
  64.          (define-key keymap "\C-a" 'bol-ilisp)
  65.          (define-key keymap "\C-c\C-c" 'interrupt-subjob-ilisp)
  66.          (define-key keymap "\C-d" 'delete-char-or-pop-ilisp)
  67.          (ilisp-defkey keymap "#" 'raw-keys-ilisp))
  68.       (ilisp-defkey keymap "\C-c" 'compile-defun-and-go-lisp)
  69.       (define-key keymap "\C-m" 'newline-and-indent-lisp))
  70.  
  71.   (define-key   keymap "]"        'close-all-lisp)
  72.   (define-key   keymap "\M-q"     'reindent-lisp)
  73.   (define-key   keymap "\C-]"     'close-and-send-lisp)
  74.   (define-key   keymap "\t"       'indent-line-ilisp)
  75.   (define-key   keymap "\n"       'newline-and-indent-lisp)
  76.   (define-key   keymap "\M-\C-q"  'indent-sexp-ilisp)
  77.   (ilisp-defkey keymap ";"        'comment-region-lisp)
  78.   (ilisp-defkey keymap ")"        'find-unbalanced-lisp)
  79.   (define-key   keymap "\M-\C-a"  'beginning-of-defun-lisp)
  80.   (define-key   keymap "\M-\C-e"  'end-of-defun-lisp)
  81.   (define-key   keymap "\C-\M-r"  'reposition-window-lisp)
  82.   (ilisp-defkey keymap "i"        'describe-lisp)
  83.   (ilisp-defkey keymap "I"        'inspect-lisp)
  84.   (ilisp-defkey keymap "a"        'arglist-lisp)
  85.   (ilisp-defkey keymap "d"        'documentation-lisp)
  86.   (ilisp-defkey keymap "m"        'macroexpand-1-lisp)
  87.   (ilisp-defkey keymap "M"        'macroexpand-lisp)
  88.   (define-key   keymap "\M-,"     'next-definition-lisp)
  89.   (define-key   keymap "\M-."     'edit-definitions-lisp)
  90.   (define-key   keymap "\M-?"     'search-lisp)
  91.   (define-key   keymap "\M-\""    'replace-lisp)
  92.   (ilisp-defkey keymap "^"        'edit-callers-lisp)
  93.   (define-key   keymap "\M-`"     'next-caller-lisp)
  94.   (define-key   keymap "\M-\t"    'complete-lisp)
  95.   (define-key   keymap "\M-\C-m"  'complete)
  96.   (ilisp-defkey keymap "r"        'eval-region-lisp)
  97.   (define-key   keymap "\M-\C-x"  'eval-defun-lisp) ; Gnu convention
  98.   (ilisp-defkey keymap "e"        'eval-defun-lisp)
  99.   (ilisp-defkey keymap "n"        'eval-next-sexp-lisp)
  100.   (ilisp-defkey keymap "p"        'package-lisp)
  101.   (ilisp-defkey keymap "P"        'set-package-lisp)
  102.   (ilisp-defkey keymap "w"        'compile-region-lisp)
  103.   (ilisp-defkey keymap "c"        'compile-defun-lisp)
  104.   (ilisp-defkey keymap "\C-r"     'eval-region-and-go-lisp)
  105.   (ilisp-defkey keymap "\C-e"     'eval-defun-and-go-lisp)
  106.   (ilisp-defkey keymap "\C-n"     'eval-next-sexp-and-go-lisp)
  107.   (ilisp-defkey keymap "\C-w"     'compile-region-and-go-lisp)
  108.   (ilisp-defkey keymap "t"        'trace-defun-lisp)
  109.   (ilisp-defkey keymap "!"        'default-directory-lisp)
  110.   (ilisp-defkey keymap " "        'mark-change-lisp)
  111.   (let ((ilisp-prefix (concat ilisp-prefix "*")))
  112.     (ilisp-defkey keymap "l"      'list-changes-lisp)
  113.     (ilisp-defkey keymap "e"      'eval-changes-lisp)
  114.     (ilisp-defkey keymap "c"      'compile-changes-lisp)
  115.     (ilisp-defkey keymap "0"      'clear-changes-lisp))
  116.   (ilisp-defkey keymap "b"        'switch-to-lisp)
  117.   (ilisp-defkey keymap "y"        'call-defun-lisp)
  118.   (ilisp-defkey keymap "z"        'reset-ilisp)
  119.   (ilisp-defkey keymap "g"        'abort-commands-lisp)
  120.   (ilisp-defkey keymap "s"        'status-lisp)
  121.   (ilisp-defkey keymap "S"        'select-ilisp)
  122.   (define-key   keymap "\C-x\C-f" 'find-file-lisp)
  123.   (ilisp-defkey keymap "l"        'load-file-lisp)
  124.   (ilisp-defkey keymap "k"        'compile-file-lisp)
  125.   (ilisp-defkey keymap "A"        'fi:clman-apropos)
  126.   (ilisp-defkey keymap "D"        'fi:clman))
  127.  
  128.  
  129.  
  130. ;;
  131. (defun ilisp-lispm-bindings ()
  132.   "Setup additional Lisp Machine-like bindings for some ilisp commands"
  133.   (interactive)
  134.   ;; Note: Changed the 'ilisp-emacs-version-id' to
  135.   ;;       '+ilisp-emacs-version-id+' and the 'gnu-*' to 'fsf-*'.
  136.   ;;       25/11/94 Marco Antoniotti
  137.   (cond ((eq +ilisp-emacs-version-id+ 'fsf-18))
  138.     ((eq +ilisp-emacs-version-id+ 'fsf-19)
  139.      (defkey-ilisp (read "[?\\S-\\C-a]") 'arglist-lisp)
  140.      (defkey-ilisp (read "[?\\S-\\C-c]") 'compile-defun-lisp)
  141.      (defkey-ilisp (read "[?\\S-\\C-d]") 'documentation-lisp)
  142.      (defkey-ilisp (read "[?\\S-\\C-e]") 'eval-defun-lisp)
  143.      (defkey-ilisp (read "[?\\S-\\C-m]") 'macroexpand-1-lisp)
  144.      (defkey-ilisp (read "[?\\M-M]") 'macroexpand-lisp))
  145.     (t
  146.      (defkey-ilisp '(control A) 'arglist-lisp)
  147.      (defkey-ilisp '(control C) 'compile-defun-lisp)
  148.      (defkey-ilisp '(control D) 'documentation-lisp)
  149.      (defkey-ilisp '(control E) 'eval-defun-lisp)
  150.      (defkey-ilisp '(control M) 'macroexpand-1-lisp)
  151.      (defkey-ilisp '(meta M) 'macroexpand-lisp))))
  152.  
  153. ;; Unfortunately, the read kludges are needed for this function to work
  154. ;; for GNU emacs 19 when it was compiled by Lucid.
  155.  
  156.  
  157.  
  158.  
  159. ;;;
  160. (defun ilisp-bindings ()
  161.   "Set up the key bindings for LISP and ILISP buffers."
  162.   (if (fboundp 'set-keymap-parent) 
  163.       (progn 
  164.     (setq ilisp-mode-map (make-sparse-keymap))
  165.     (set-keymap-parent ilisp-mode-map comint-mode-map))
  166.     (setq ilisp-mode-map (copy-keymap comint-mode-map)))
  167.  
  168.   ;; Remove stop and quit subjob from comint
  169.   (define-key ilisp-mode-map "\C-c\C-z" nil)
  170.   (define-key ilisp-mode-map "\C-c\C-\\" nil)
  171.   (if (fboundp 'lisp-mode-commands)
  172.       (lisp-mode-commands ilisp-mode-map))
  173.   (lisp-bindings ilisp-mode-map t)
  174.   (if (boundp 'lisp-mode-map) 
  175.       (lisp-bindings lisp-mode-map))
  176.   (if (boundp 'scheme-mode-map) 
  177.       (lisp-bindings scheme-mode-map))
  178.   (ilisp-defkey emacs-lisp-mode-map ";" 'comment-region-lisp)
  179.  
  180.   (ilisp-defkey global-map "\C-t" 'trace-defun-lisp-break)
  181.   (ilisp-defkey global-map "b" 'switch-to-lisp)
  182.  
  183.   ;; Globally defined output-control commands.
  184.   (ilisp-defkey global-map "1" 'ilisp-bury-output)
  185.   (ilisp-defkey global-map "v" 'ilisp-scroll-output)
  186.   (ilisp-defkey global-map "G" 'ilisp-grow-output)
  187.  
  188.   (if (not (boundp 'fi:clman-mode-map))
  189.       (setq fi:clman-mode-map (make-sparse-keymap)))
  190.   (ilisp-defkey fi:clman-mode-map "D" 'fi:clman)
  191.   (ilisp-defkey fi:clman-mode-map "A" 'fi:clman-apropos))
  192.